Skip to main content

Add

Adds a new value to the combo box / dropdown list content control.

Syntax

expression.Add(sText, sValue, nIndex);

expression - A variable that represents a ApiContentControlList class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringThe display text for the list item.
sValueOptionalstringsTextThe list item value.
nIndexOptionalnumberthis.GetElementsCount()A position where a new value will be added.

Returns

boolean

Example

let doc = Api.GetDocument();
Api.pluginMethod_AddContentControlList(1, [{Display: "Item1_D", Value: "Item1_V"}, {Display: "Item2_D", Value: "Item2_V"}], {"Id": 100, "Tag": "CC_Tag", "Lock": 3});
let contentControls = doc.GetAllContentControls();
let contentControlList = contentControls[0].GetDropdownList();
contentControlList.Add("Item3_D", "Item3_V", 2);
doc.AddElement(0, contentControlList);